#coding:utf-8
import datetime

from exts import db

class Result(db.Model):
    __tablename__ = 'auto_result'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    mockid = db.Column(db.Integer)
    name = db.Column(db.String(150))
    testresult = db.Column(db.Boolean)
    reqmethod = db.Column(db.String(10))
    rspcode = db.Column(db.String(10))
    reqpath = db.Column(db.String(100))
    reqhead = db.Column(db.Text)
    reqbody = db.Column(db.Text)
    rsphead = db.Column(db.DateTime())
    rspbody = db.Column(db.Text)
    diff = db.Column(db.Text)
    durtime = db.Column(db.String(50))
    ts = db.Column(db.DateTime(), default=datetime.datetime.utcnow())

class Testcase(db.Model):
    __tablename__ = 't_testcase'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    casename = db.Column(db.String(200))
    ifid = db.Column(db.Integer)
    reqmethod = db.Column(db.String(10))
    reqpath = db.Column(db.String(100))
    reqhead = db.Column(db.Text)
    reqbody = db.Column(db.Text)
    rspcode = db.Column(db.String(10))
    rsphead = db.Column(db.Text)
    rspbody = db.Column(db.Text)
    rspcheck = db.Column(db.Text)
    iscase = db.Column(db.Boolean)
    status = db.Column(db.String(11))
    ts = db.Column(db.DateTime(), default=datetime.datetime.utcnow())

# class avlDept(db.Model):
#     __tablename__ = 't_avl_dept'
#     id = db.Column(db.Integer, primary_key=True, autoincrement=True)
#     dept_code = db.Column(db.String(64),nullable=False)
#     dept_name = db.Column(db.String(32),nullable=False)
#     status = db.Column(db.String(11))
#     ts = db.Column(db.DateTime())
#     useage = db.Column(db.String(100))

class systemDept(db.Model):
    __tablename__ = 't_avl_deptID'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    deptid = db.Column(db.String(255))
    status = db.Column(db.String(11))
    ts = db.Column(db.DateTime())
    useage = db.Column(db.String(100))

class config(db.Model):
    __tablename__ = 't_config'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    config_Key = db.Column(db.String(100))
    config_value = db.Column(db.String(100))
    status = db.Column(db.String(11))
    ts = db.Column(db.DateTime())